package ch02;

/**
 * @author chenmin
 * @desc TODO
 * @date 2025/9/2
 */
import java.util.Scanner;
public class For2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.print("请输入金字塔的行数n：");
        int n = in.nextInt();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n - i; j++) {
                System.out.print(" ");
            }
            for (int k = 1; k <= 2 * i - 1; k++) {
                System.out.print("*");
            }
            System.out.println();
        }
        in.close();
    }
}

